#!/bin/sh
CTCSDK_VER=5.7.2
CTCSDK_DIR=$(pwd)/${CTCSDK_VER}
if [ -z $1 ]; then
	echo "Usage: $0 [ clean | phy | all ]"
else
	cd ${CTCSDK_DIR}
	case $1 in
	clean)
		make clean
		[ $? -eq 0 ] || exit
		if [ -d ${CTCSDK_DIR}/build.arm.d ]; then
		    rm -rf ${CTCSDK_DIR}/build.arm.d
	        fi
		;;
	phy)
		make libphy
		[ $? -eq 0 ] || exit
		;;
	all)
		make libphy
		[ $? -eq 0 ] || exit
		make libctcsdk
		[ $? -eq 0 ] || exit
		make libapp
		[ $? -eq 0 ] || exit
		make kdal
		[ $? -eq 0 ] || exit
		make ctc_shell
		[ $? -eq 0 ] || exit
		make dkcli
		[ $? -eq 0 ] || exit
		make app
		[ $? -eq 0 ] || exit
		;;
	*)
		make $1
	esac
fi
